package com.xy.biz.base.domain.converter;

import com.xy.biz.base.domain.bo.BomEquipmentBO;
import com.xy.biz.base.domain.po.BomEquipmentPO;
import com.xy.biz.base.domain.req.SaveBomEquipmentRequest;
import com.xy.biz.base.domain.resp.GetBomEquipmentResponse;
import com.xy.tool.util.BeanUtilsEx;

import java.util.Collection;
import java.util.List;

/**
 *
 *
 * @author zgy
 * @date 2022-3-7
 */
public class BomEquipmentConverter {

	public static BomEquipmentPO toPO(BomEquipmentBO source) {
		return BeanUtilsEx.copyProperties(source, () -> new BomEquipmentPO(), true);
	}

	public static List<BomEquipmentPO> toPO(Collection<BomEquipmentBO> source) {
		return BeanUtilsEx.copyPropertiesForNewList(source, () -> new BomEquipmentPO(), true);
	}

	public static BomEquipmentBO fromPO(BomEquipmentPO source) {
		return BeanUtilsEx.copyProperties(source, () -> new BomEquipmentBO());
	}

	public static List<BomEquipmentBO> fromPO(Collection<BomEquipmentPO> source) {
		return BeanUtilsEx.copyPropertiesForNewList(source, () -> new BomEquipmentBO());
	}

	public static BomEquipmentBO toBO(SaveBomEquipmentRequest source) {
		return BeanUtilsEx.copyProperties(source, () -> new BomEquipmentBO(), true);
	}

	public static List<BomEquipmentBO> toBO(Collection<SaveBomEquipmentRequest> source) {
		return BeanUtilsEx.copyPropertiesForNewList(source, () -> new BomEquipmentBO(), true);
	}

	public static GetBomEquipmentResponse toResponse(BomEquipmentBO source) {
		return BeanUtilsEx.copyProperties(source, () -> new GetBomEquipmentResponse());
	}

	public static List<GetBomEquipmentResponse> toResponse(Collection<BomEquipmentBO> source) {
		return BeanUtilsEx.copyPropertiesForNewList(source, () -> new GetBomEquipmentResponse());
	}

}
